﻿
Imports storoomc
Imports elpmis
Imports lpmsengi
Imports managedServer
Imports occommon

Public Class configDelegate
    Inherits requestProcessor

    Public Const _pathidentity As String = "__INVALID_PATH_IDENTITY__"
    Private Shared _idsysUrl As String = Nothing

    Public Overrides Sub initial(Optional ByVal config As configParser = Nothing)
        MyBase.initial(config)
        assert(Not config Is Nothing)
        _idsysUrl = config.parameter(configNaming.onlinecookie.section,
                                     configNaming.onlinecookie.idsysUrl,
                                     configNaming.defaultValue.onlinecookie.idsysUrl)
        assert(storoom.initial(config, configNaming.storoom.section))
        lpmsengi.initial(config)
        loosenSPMLimit(ProHttpS.processorHttpServer().threadCount())
        For Each i As Reflection.FieldInfo In _
            GetType(query).GetFields(Reflection.BindingFlags.Public Or Reflection.BindingFlags.Static)
            sharedContext.insertVariable("query." + i.Name, typeDefination.string, i.GetValue(Nothing))
        Next
        sharedContext.insertVariable("path.siteGet", typeDefination.string, siteGet._pathidentity)
        sharedContext.insertVariable("path.siteSet", typeDefination.string, siteSet._pathidentity)
        sharedContext.insertVariable("path.userGet", typeDefination.string, userGet._pathidentity)
        sharedContext.insertVariable("path.userGetUI", typeDefination.string, userGetUI._pathidentity)
        sharedContext.insertVariable("path.userSet", typeDefination.string, userSet._pathidentity)
        sharedContext.insertVariable("path.userSetUI", typeDefination.string, userSetUI._pathidentity)
    End Sub

    Public Shared Function idsysUrl() As String
        Return copy(_idsysUrl)
    End Function

    Public Overrides Function pathidentity() As String
        Return _pathidentity
    End Function

    Public Overrides Function process(ByVal context As httpContext) As Boolean
        Return debugassert(False)
    End Function
End Class

Namespace configNaming
    Namespace onlinecookie
        Public Module _onlinecookie
            Public Const section As String = "onlinecookie"
            Public Const idsysUrl As String = "idsysUrl"
        End Module
    End Namespace

    Namespace storoom
        Public Module _storoom
            Public Const section As String = "storoom"
        End Module
    End Namespace

    Namespace defaultValue
        Namespace onlinecookie
            Public Module _onlineCookie
                Public Const idsysUrl As String = idcommon.defaultServerUrl
            End Module
        End Namespace
    End Namespace
End Namespace
